@(content: String, commentId: Int,
  repository: gitbucket.core.service.RepositoryService.RepositoryInfo)(implicit context: gitbucket.core.controller.Context)
<span class="error-edit-content-@commentId error"></span>
@gitbucket.core.helper.html.preview(
  repository         = repository,
  content            = content,
  enableWikiLink     = false,
  enableRefsLink     = true,
  enableLineBreaks   = true,
  enableTaskList     = true,
  hasWritePermission = true,
  completionContext  = "issues",
  style              = "",
  elastic            = true,
  focus              = true,
  tabIndex           = 1
)
<div class="text-right">
  <input type="button" class="cancel-comment-@commentId btn btn-small btn-default" value="Cancel"/>
  <input type="button" class="update-comment-@commentId btn btn-small btn-success" value="Update comment"/>
</div>
<script>
$(function(){
  var curriedCallback = function($box) {
    return function(data){
      $('.update-comment-@commentId, .cancel-comment-@commentId', $box).removeAttr('disabled');
      $('.commit-commentContent-@commentId').empty().html(data.content);
      prettyPrint();
    }
  }

  $(document).on('click', '.update-comment-@commentId', function(){
    var content = $(this).parent().parent().find('textarea[name=content]').val();
    $box = $(this).closest('.commit-comment-box');
    $('.update-comment-@commentId, .cancel-comment-@commentId', $box).attr('disabled', 'disabled');
    $.ajax({
      url: '@context.path/@repository.owner/@repository.name/commit_comments/edit/@commentId',
      type: 'POST',
      data: {
        content : content
      }
    }).done(
      curriedCallback($box)
    ).fail(function(req) {
      $('.update-comment-@commentId, .cancel-comment-@commentId', $box).removeAttr('disabled');
      $('.error-edit-content-@commentId', $box).text($.parseJSON(req.responseText).content);
    });
  });

  $(document).on('click', '.cancel-comment-@commentId', function(){
    $box = $(this).closest('.box');
    $('.update-comment-@commentId, .cancel-comment-@commentId', $box).attr('disabled', 'disabled');
    $.get('@context.path/@repository.owner/@repository.name/commit_comments/_data/@commentId', curriedCallback($box));
    return false;
  });
});
</script>
